package com.webserver.http;

import java.util.HashMap;
import java.util.Map;

/**
 * 当前类用于定义那些在Http协议中规定内容，以便进行复用
 */
public class HttpContext {
    /**
     * 回车符
     */
    public static final char CR = 13;
    /**
     * 换行符
     */
    public static final char LF = 10;
    /**
     * MIME类型映射
     * key：资源的后缀名，如：css，png，html等等
     * value：该资源类型对应的MIME值：如：text/css,image/png,text/html等等
     */
    private static Map<String,String> mineMapping = new HashMap<>();
    static {
        initMiMeMapping();
    }
    private static void initMiMeMapping(){
        mineMapping.put("html","text/html");
        mineMapping.put("css","text/css");
        mineMapping.put("js","application/javascript");
        mineMapping.put("png","image/png");
        mineMapping.put("jpg","image/jpeg");
    }
    public static String getMineType(String ext){
        return mineMapping.get(ext);
    }



}
